<template>

	<view>
		<bg-video></bg-video>
		<cu-custom bgColor="bg-main" :isBack="true">
			<block slot="content">预约记录详细</block>
		</cu-custom>

		<view class="bg-white padding-sm">
			<view
				:class="item.statu == 'C' ? 'text-red' : (item.statu == 'R' ? 'text-blue' : (item.statu == 'U' ? 'text-yellow' : 'text-gray'))"
				class="padding-sm flex justify-between align-center">
				<text>{{item.yyjlitemid}}</text>
			</view>
			<view class="padding-sm flex justify-between align-center">
				<text
					:class="item.statu == 'C' ? 'text-red' : (item.statu == 'R' ? 'text-blue' : (item.statu == 'U' ? 'text-yellow' : 'text-gray'))"
					>{{yystu[item.statu]}}</text>
				<text>
					<text class="text-red">实付金额：￥{{item.sfje / 100}}</text>
					<text class="margin-lr-sm">/</text>
					<text class="text-gray">金额：￥{{item.je / 100}}</text>
				</text>
			</view>
			<view class="padding-sm">
				<text>预约日期：</text>
				<text>{{item.rq}}</text>
			</view>
			<view class="padding-sm">
				<text>预约时间：</text>
				<text>{{item.st}} - {{item.et}}</text>
			</view>
			<view class="padding-sm">
				<text>预约门店：</text>
				<text>{{item.mdmc}}</text>
			</view>
			<view class="padding-sm">
				<text>预约房间：</text>
				<text>{{item.fjmc}}</text>
			</view>
			<view class="padding-sm">
				<text class="cuIcon-locationfill text-main"></text>
				<text class="margin-left-xs text-sm">
					<text>{{md.sheng}}</text>
					<text>{{md.shi}}</text>
					<text>{{md.qu}}</text>
					<text>{{md.address}}</text>
				</text>
			</view>
			<view v-if="item.qid" class="padding-sm flex justify-between align-center">
				<text>核销ID：{{item.qid}}</text>
				<text>
					核销平台：<text class="text-gray">{{qtype[item.qtype]}}</text>
				</text>
			</view>
			<view v-if="item.statu == 'R'" class="padding-sm">
				<button @tap="tuQcode(item.yyjlitemid)" class="cu-btn bg-main">进门</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data: function() {
			return {
				item: {},
				yystu: {},
				qtype: {},
				locamap: {},
				md: {}

			};

		},
		created: function() {
			this.constant.get("YYSTU").then(data => {
				this.yystu = data.YYSTU;
			});
			this.constant.get("QTYPE").then(data => {
				this.qtype = data.QTYPE;
			});
			this.locamap = this.location.localmap;
		},
		onLoad: function(option) {
			this.item.yyjlitemid = option.yyjlitemid;
			this.getItem();
		},

		methods: {
			getItem: function() {
				this.api("/yy/item/info/get").send({
					yyjlitemid: this.item.yyjlitemid
				}).then(data => {
					this.md = data.md;
					this.md.sheng = this.location.localmap.cmap[this.md.pcode].criname;
					this.md.shi = this.location.localmap.cmap[this.md.scode].criname;
					this.md.qu = this.location.localmap.cmap[this.md.qcode].criname;

					this.item = data.yyjlitem;
				});
			},
			tuQcode: function(id) {
				uni.navigateTo({
					url: `/pages/cyy/yy/qcode?yyjlitemid=${id}`
				})
			}


		},

	}
</script>

<style scoped>



</style>